package com.ae.service.impl;

import com.ae.mapper.SpeakerMapper;
import com.ae.pojo.QueryVo;
import com.ae.pojo.Speaker;
import com.ae.service.SpeakerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author bug-termination
 * @date 2020-10-19 21:05
 */
@Service
public class SpeakerServiceImpl implements SpeakerService {


    @Autowired
    private SpeakerMapper speakerMapper;
    @Override
    public Speaker selectByPrimaryKey(Integer id) {
        return speakerMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Speaker> findAllSpeaker() {

        return speakerMapper.findAllSpeaker();
    }

    @Override
    public List<Speaker> findAllSpeaker(QueryVo queryVo) {
        return speakerMapper.findAllSpeaker(queryVo);
    }

    @Override
    public Integer getTotalCount() {
        return speakerMapper.getTotalCount();
    }

    @Override
    public void addSpeaker(Speaker speaker) {
        speakerMapper.insert(speaker);
    }

    @Override
    public int updateSpeaker(Speaker speaker) {
        return speakerMapper.updateByPrimaryKeySelective(speaker);
    }

    @Override
    public int deleteSpeaker(Integer id) {
        return speakerMapper.deleteByPrimaryKey(id);
    }


    @Override
    public Speaker findById(Integer id) {

        Speaker speaker = speakerMapper.selectByPrimaryKey(id);

        return speaker;
    }

}
